using System;
using System.Collections.Generic;
using SubversionReports.Entities;
using SubversionReports.Utilities;

namespace SubversionReports.Web
{
    public partial class GoogleCode : Page
    {
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            int page = int.Parse(Request["PageNumber"] ?? "1");
            List<RepositorySummary> repositoryList = Google.GetRepositoryListFromCache();
            Google.AppendRandomEntries(repositoryList);
            PageLinks1.NonPagedCount = repositoryList.Count;
            CodeSearchResultsRepeater.DataSource = repositoryList.GetRange((page -1) * 10, 10);
            CodeSearchResultsRepeater.DataBind();
        }
    }
}
